<?php

class ElseComponent extends BlueprintComponent {
	
	
	function parse(&$element) {
		$doc = $element->document;
		$PHPNode = $element->previousSibling;
		while ($PHPNode && $PHPNode->nodeType != DOM_PHP_NODE) $PHPNode =& $PHPNode->previousSibling;
		
		if ($PHPNode->nodeType != DOM_PHP_NODE) {
			trigger_error("Else component does not come directly following an If component on line $element->startLine<br \>
			In template <strong>$doc->file</strong> on line <strong>$element->startLine</strong>", E_USER_WARNING);
		}
		$PHPNode->data = "} else {";
		$element->parentNode->insertBefore($doc->createPHPNode("}"), $element->nextSibling);
	}
}
?>